home *** CD-ROM | disk | FTP | other *** search
/ SGI Hot Mix 17 / Hot Mix 17.iso / HM17_SGI / research / lib / obsolete / vmscode.pro < prev    next >
Text File  |  1997-07-08  |  2KB  |  67 lines

  1. ; $Id: vmscode.pro,v 1.2 1997/01/15 04:02:19 ali Exp $
  2. ;
  3. ; Copyright (c) 1988-1997, Research Systems, Inc.  All rights reserved.
  4. ;       Unauthorized reproduction prohibited.
  5.  
  6. function VMSCODE, CODE, FROM_V1VMS=from_vms
  7. ;+
  8. ; Name:
  9. ;    VMSCODE
  10. ;
  11. ; PURPOSE:
  12. ;    Convert between VMS Version 1 and the newer IDL type codes.
  13. ;
  14. ;        Type           VMS V1    Current
  15. ;        -------------------------------
  16. ;        undefined      0      0
  17. ;        byte          2      1
  18. ;        int          4      2
  19. ;        long         16      3
  20. ;        float          8      4
  21. ;        double         32      5
  22. ;        complex         64      6
  23. ;        string          1      7
  24. ;        structure    128      8
  25. ;
  26. ; CATEGORY:
  27. ;    Misc.
  28. ;
  29. ; CALLING SEQUENCE:
  30. ;    VMSCODE, Code
  31. ;
  32. ; INPUTS:
  33. ;    Code:    The type code to be converted.
  34. ;
  35. ; KEYWORDS:
  36. ;   FROM_V1VMS:    Normally, CODE is taken to be for the current system
  37. ;        and is is converted to it's VMS V1 counterpart. If FROM_V1VMS
  38. ;        is present and non-zero, the conversion direction is reversed.
  39. ;
  40. ; OUTPUTS:
  41. ;    The translated code is returned as an integer.
  42. ;
  43. ; COMMON BLOCKS:
  44. ;    None.
  45. ;
  46. ; SIDE EFFECTS:
  47. ;    None.
  48. ;
  49. ; RESTRICTIONS:
  50. ;    None.
  51. ;
  52. ; MODIFICATION HISTORY:
  53. ;    AB, RSI, February 1988
  54. ;-
  55.     on_error,2                          ;Return to caller if an error occurs
  56.     vms_codes = [0, 2, 4, 16, 8, 32, 64, 1, 128]
  57.  
  58.     if (KEYWORD_SET(from_vms)) then begin
  59.         for i=0,8 do if (code eq vms_codes(i)) then return,i
  60.         return,0    ; If code was invalid, return TYP_UNDEF.
  61.     endif else begin
  62.         ; If bad code, return TYP_UNDEF
  63.         if ((code lt 0) or (code gt 8)) then return,0
  64.         return,vms_codes(code);    ; Valid code - translate
  65.     endelse
  66. end
  67.